<%--
  Created by IntelliJ IDEA.
  User: kkk
  Date: 2022/11/7
  Time: 18:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/statics/layui/css/layui.css"/>
    <script src="${pageContext.request.contextPath}/statics/layui/layui.js"  charset="utf-8"></script>
</head>
<body>
<div style="color: #ff0000">${erroeMsg}</div><form class="layui-form" action="supplierAdd" method="post">
    <div class="layui-form-item">
        <label class="layui-form-label">供应商编号</label>
        <div class="layui-input-block">
            <input type="text" name="supCode" id="supCode" lay-verify="title" autocomplete="off" placeholder="请输入供应商编号" class="layui-input">
            <span>${supCodeError}</span>
            <span id="supCodeSpan"></span>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">供应商名称</label>
        <div class="layui-input-block">
            <input type="text" name="supName" lay-verify="title" autocomplete="off" placeholder="请输入供应商名称" class="layui-input">
            <span>${supNameError}</span>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">供应商描述</label>
        <div class="layui-input-block">
            <input type="text" name="supDesc" lay-verify="title" autocomplete="off" placeholder="请输入描述" class="layui-input">
            <span>${supDescError}</span>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">供应商联系人</label>
        <div class="layui-input-block">
            <input type="text" name="supConcat" lay-verify="title" autocomplete="off" placeholder="请输入供应商联系人" class="layui-input">
            <span>${supConcatError}</span>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">联系电话</label>
        <div class="layui-input-block">
            <input type="text" name="supPhone" lay-verify="title" autocomplete="off" placeholder="请输入联系电话" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">供应商地址</label>
        <div class="layui-input-block">
            <input type="text" name="supAddress" lay-verify="title" autocomplete="off" placeholder="请输入供应商地址" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

<script>
    layui.use(['form','jquery'], function(){
        var form = layui.form;
        var $ = layui.jquery;


        $("#supCode").blur(function () {
            $.get("supCodeExists?supCode="+this.value,function (data) {
                if (data=="1") {
                    $("#supCodeSpan").html("该供应商编号已存在");
                    $("#supCode").html("");
                }else {
                    $("#supCodeSpan").html("");
                }
            })
        })

    });
</script>
</body>
</html>
